import requests

resp = requests.post(url="http://ihrm2-test.itheima.net/api/sys/login",
                     json={"mobile": "13800000002", "password": "123456"})
print("登录成功")
token = resp.json().get("data")
#架构列表
resp=requests.get(url="http://ihrm2-test.itheima.net/api/company/department",
                  headers={"Authorization":token})
print("架构列表",resp.json())
# #获取部门信息
resp=requests.get(url="http://ihrm2-test.itheima.net/api/company/department/1549017831687974912",
             headers={"Authorization":token})
print("查询部门",resp.json())
#部门添加
resp=requests.post(url="http://ihrm2-test.itheima.net/api/company/department",
              headers={"Content-Type" :"application/json","Authorization": token},
              json={"name": "会飞的猪","code":"3452"})
print("添加部门",resp.json())
#部门修改
resp=requests.put(url="http://ihrm2-test.itheima.net/api/company/department/1549367878191542272",
                  headers={"Content-Type" :"application/json","Authorization": token},
                  json={"name": "会飞的狗","code":"3455"})
print("修改部门",resp.json())
#部门删除
resp=requests.delete(url="http://ihrm2-test.itheima.net/api/company/department/1549367878191542272",
                headers={"Authorization":token})
print("删除部门",resp.json())

